package com.waylau.spring.boot.blog.util;

import com.hankcs.hanlp.HanLP;
import com.hankcs.hanlp.seg.common.Term;
import com.hankcs.hanlp.suggest.Suggester;
import com.hankcs.hanlp.tokenizer.NLPTokenizer;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by Zhou Bing
 * <p>
 * 2018/3/8.
 */
@Component
public class HanLPUtil {
    /**
     * 关键字提取
     * @param content 内容
     * @param size 数量
     * @return
     */
    public List<String> getMainIdea(String content,Integer size) {
        return HanLP.extractKeyword(content, size);
    }

    /**
     * 短语提取
     */
    public List<String> getDuanYu(String text,Integer size) {
        return HanLP.extractPhrase(text, size);
    }

}